package szwolaiyun.paireach.com.szwolaizhuang.net;

import java.util.HashMap;

import szwolaiyun.paireach.com.szwolaizhuang.model.requestTag.RequestTag;

/**
 * 运单请求
 */
public class WayBillRequest implements WayBillInterface {
    @Override
    public void getOrderNumber(String phoneNumber) {
        MainRequest.getInstance().makeStringGetRequest(BaseUrl.zhuang + "getOrder.a?mobile=" + phoneNumber, RequestTag.GET_ORDER_NUMBER_BY_PHONE);
    }

    @Override
    public void getOrderHandlingState(String orderNumber) {
        MainRequest.getInstance().makeStringGetRequest(BaseUrl.zhuang + "orderHandling.a?orderCode=" + orderNumber, RequestTag.GET_ORDER_STATE_BY_ORDER_NUMBER);
    }

    @Override
    public void loadAllOrder(String phoneNumber) {
        HashMap<String, String> map = new HashMap<>();
        map.put("driverTel", phoneNumber);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "loadAllOrder.a", map, RequestTag.GET_ALL_WAY_BILL);
    }

    @Override
    public void loadFirstAvailableOrder(String phoneNumber) {
        HashMap<String, String> map = new HashMap<>();
        map.put("mobile", phoneNumber);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "loadFirstUnCheckOrder.a", map, RequestTag.GET_FIRST_AVAILABLE_WAY_BILL);
    }

    @Override
    public void getOrderGoodsDetail(String orderNo) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderNo);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "loadOrderDetailById.a", map, RequestTag.GET_WAY_BILL_DETAIL_GOODS);
    }

    @Override
    public void saveOrderRunningTrack(String orderCode, String driverTel, double longitude, double latiude, String speed, String direction, String address, String province, String city, String area, String remark, Character active) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderCode);
        map.put("driverTel", driverTel);
        map.put("longitude", longitude + "");
        map.put("latiude", latiude + "");
        map.put("speed", speed);
        map.put("direction", direction);
        map.put("address", address);
        map.put("province", province);
        map.put("city", city);
        map.put("area", area);
        map.put("remark", remark);
        map.put("active", "Y");
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "saveTrackList.a", map, RequestTag.SAVE_TRACK);
    }

    @Override
    public void driverAcceptOrder(String orderNo) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderNo);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "driverAcceptOrder.a", map, RequestTag.DRIVER_ACCEPT_ORDER);
    }

    @Override
    public void sign(String orderNo, double lat, double lng) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderNo);
        map.put("lat", String.valueOf(lat));
        map.put("lng", String.valueOf(lng));
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "orderHandling.a", map, RequestTag.SIGN);
    }

    @Override
    public void canDriverEnterToLoadGoods(String orderNo) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderNo);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "canEnterFactory.a", map, RequestTag.CAN_LOAD_ENTER);
    }

    @Override
    public void canDriverEnterToReceiptGoods(String orderNo) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderNo);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "canEnterDcFactory.a", map, RequestTag.CAN_RECEIPT_ENTER);
    }

    @Override
    public void getOrderDetailByOrderNumberAndPhone(String orderNumber, String phoneNumber) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderNumber);
        map.put("mobile", phoneNumber);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "queryOrder.a", map, RequestTag.GET_ORDER_DETAIL);
    }

    @Override
    public void getOrderDetailByOrderNumber(String orderNumber) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderNumber);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "queryOrderByCode.a", map, RequestTag.GET_ORDER_DETAIL_BY_ORDER_NO);
    }

    @Override
    public void getIfCanEnterDC(String orderNumber) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderNumber);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "canEnterDcFactory.a", map, RequestTag.GET_IF_CAN_ENTER_DC);
    }

    @Override
    public void dcEnterFactory(String orderNumber) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderNumber);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "orderHandling.a", map, RequestTag.DC_ENTER);
    }

    @Override
    public void 叉车工装卸货操作(String orderNumber) {
        MainRequest.getInstance().makeStringGetRequest(BaseUrl.zhuang + "orderHandling.a?orderCode=" + orderNumber, RequestTag.叉车工装卸货操作);
    }

    @Override
    public void 叉车工判断是否能进行装货卸货(String orderNumber) {
        MainRequest.getInstance().makeStringGetRequest(BaseUrl.zhuang + "orderHandling.a?orderCode=" + orderNumber, RequestTag.叉车工判断是否能进行装货卸货);
    }

    @Override
    @Deprecated
    public void 获取运单可用的排班日期(String orderCode) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderCode);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "querySchedDate.a", map, RequestTag.获取运单可用的排班日期);
    }

    @Override
    @Deprecated
    public void 获取运单可用的排班时间(String orderCode, String planDate) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderCode);
        map.put("planDate", planDate);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "querySchedTime.a", map, RequestTag.获取运单可用的排班时间);
    }

    @Override
    @Deprecated
    public void 修改装货预约时间(String orderCode, String planDate, String startTime, String endTime) {
        HashMap<String, String> map = new HashMap<>();
        map.put("orderCode", orderCode);
        map.put("planDate", planDate);
        map.put("startTime", startTime);
        map.put("endTime", endTime);
        MainRequest.getInstance().makeStringPostRequest(BaseUrl.zhuang + "updateUnLoadSched.a", map, RequestTag.修改装货预约时间);
    }
}
